//购物车初始数据
function loadWebList() {
    $.ajax({
        url: "findShoppingByShoppingCompanyList",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        success: function (data) {
            var code = ' ';
            if (data.code == 500) {

            } else {
                for (var i = 0; i < data.shopping_List.length; i++) {

                    code += " <div class=\"list-view-layout1\">\n" +
                        "                                <div class=\"product-box-layout3\">\n" +
                        "                                    <div class=\"item-img\">\n" +
                        "                                        <a href=web-orderList.html?id=" + data.shopping_List[i].compID + "><img style='width: 275px;height: 195px;' src='upload/" + data.shopping_List[i].companyEntity.compPhoto + "'\n" +
                        "                                                                            alt=\"Product\"></a>\n" +
                        "                                    </div>\n" +
                        "                                    <div class=\"product-info\">\n" +
                        "                                        <div class=\"item-content\">\n" +
                        "                                            <h3 class=\"item-title\"><a href=web-orderList.html?id=" + data.shopping_List[i].compID + ">\n" +
                        "                                             " + data.shopping_List[i].companyEntity.compName + "</a><span>New</span></h3>\n" +
                        "                                            <ul class=\"entry-meta\">\n" +
                        "                                                <li><i class=\"far fa-clock\"></i>   " + data.shopping_List[i].companyEntity.compDate + "</li>\n" +
                        "                                            </ul>\n" +
                        "                                        </div>\n" +
                        "                                        <div class=\"item-right\">\n" +
                        "                                            <div class=\"item-price\">\n" +

                        "                                            </div>\n" +
                        "                                            <div class=\"item-btn\">\n" +
                        "                                                <a href=web-orderList.html?id=" + data.shopping_List[i].compID + ">Details</a>\n" +
                        "                                            </div>\n" +
                        "                                        </div>\n" +
                        "                                    </div>\n" +
                        "                                </div>\n" +
                        "                            </div> ";
                }
                $("#data_1").append(code);
            }
        }
    });
}

$(function () {
    var DATA = '';
    $.ajax({
        url: "JudgeLogin_4",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        success: function (data) {
            if (data.code == 500) {
                DATA += " <li class=\"header-btn\">\n" +
                    "                                    <a href=\"web-login.html\" class=\"item-btn\"><i class=\"fas fa-plus\"></i>登录</a>\n" +
                    "                                </li>"
                Swal.fire("温馨提示", "请先登录", "warning");
                window.location.href = "web-404.html";
            } else {
                DATA += " <li class=\"header-login-icon\">\n" +
                    "                                    <a href=\"web-account.html\" class=\"color-light\" data-toggle=\"tooltip\"\n" +
                    "                                       data-placement=\"top\" title=\"Login/Register\">\n" +
                    "                                        <i class=\"far fa-user\">我的</i>\n" +
                    "                                    </a>\n" +
                    "                                </li>\n" +
                    "                                <li class=\"header-btn\">\n" +
                    "                                    <a  onclick='tuichu()' class=\"item-btn\"><i class=\"fas fa-plus\"></i>退出</a>\n" +
                    "                                </li>";
                loadWebList();
            }
            $("#userData").html("");
            $("#userData").append(DATA);
        }
    });
})